

import request from '@/router/axios'

export function fetchList(query) {
  return request({
    url: '/gen/generator/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/gen/dsconf/',
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: '/gen/generator/' + id,
    method: 'get'
  })
}

export function delObj(ids) {
  return request({
    url: '/gen/generator/' + ids,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/gen/generator/update',
    method: 'put',
    data: obj
  })
}

// 预览生成代码
export function previewTable(id) {
  return request({
    url: '/gen/generator/preview/' + id,
    method: 'get'
  })
}

// 生成代码
export function genCode(tableNames) {
  return request({
    url: '/gen/generator/genCode/' + tableNames,
    method: 'get'
  })
}

export function listDbTable(query) {
  return request({
    url: '/gen/generator/db/list',
    method: 'get',
    params: query
  })
}

// 导入表
export function importTable(tables,dataSource) {
  const data = {
    tables,
    dataSource
  }
  return request({
    url: '/gen/generator/importTable',
    method: 'post',
    params: data
  })
}




